import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  HousepropertyInformationVO,
  HousepropertyInformationForm,
  HousepropertyInformationQuery
} from '@/api/zichanguanli/housepropertyInformation/types';
import { UnwrapRef } from 'vue';

/**
 * 查询房产(其他)租赁信息列表
 * @param query
 * @returns {*}
 */

export const listHousepropertyInformation = (query?: HousepropertyInformationQuery): AxiosPromise<HousepropertyInformationVO[]> => {
  return request({
    url: '/zichanguanli/housepropertyInformation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询房产(其他)租赁信息详细
 * @param id
 */
export const getHousepropertyInformation = (query: any): AxiosPromise<HousepropertyInformationVO> => {
  return request({
    url: '/zichanguanli/housepropertyInformation/query',
    method: 'get',
    params: query
  });
};

/**
 * 新增房产(其他)租赁信息
 * @param data
 */
export const addHousepropertyInformation = (data: {
  basicPropertyInformationBo: UnwrapRef<{
    id: null;
    primarySinglet: undefined;
    propertyName: undefined;
    type: undefined;
    propertyLocation: undefined;
    doorNumber: undefined;
    floorArea: undefined;
    realEstateRegistrationNumber: undefined;
    propertyValuation: undefined;
    leaseStatus: undefined;
  }>;
  houseRentalBo: UnwrapRef<{
    id: undefined;
    name: undefined;
    associate: undefined;
    contactInformation: undefined;
    leaseholdArea: undefined;
    termContract: undefined;
    startTime: undefined;
    endTime: undefined;
    remainingDays: undefined;
    contractNumber: undefined;
    rentRegulation: undefined;
    appraisedAnnualRent: undefined;
    incrementDate: undefined;
    increasingCountdown: undefined;
    incrementalCriterion: undefined;
    electricityRateStandard: undefined;
    waterTariff: undefined;
    houseId: undefined;
    rentOutStatus: undefined;
    equivalentDailyRent: undefined;
    frentPaymentFrequency: undefined;
    rentOutTime: undefined;
  }>;
  rentCollectionPlanBo: Array<UnwrapRefSimple<any>>;
}) => {
  return request({
    url: '/zichanguanli/housepropertyInformation',
    method: 'post',
    data: data
  });
};

/**
 * 修改房产(其他)租赁信息
 * @param data
 */
export const updateHousepropertyInformation = (data: HousepropertyInformationForm) => {
  return request({
    url: '/zichanguanli/housepropertyInformation',
    method: 'put',
    data: data
  });
};

/**
 * 删除房产(其他)租赁信息
 * @param id
 */
export const delHousepropertyInformation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/housepropertyInformation/' + id,
    method: 'delete'
  });
};
